#include <cstdio>

int main( )
{
    int i, n, t, h, m, s, tz;
    float d, th;
    bool cor;
    char time[ 8 ];
    scanf("%d%f", &n, &d);
    while ( scanf("%d", &t) != EOF )
    {
        cor = true;
        tz = 0;
        for ( i = 0; i < n; i++ )
        {
            scanf("%s", time);
            if ( time[ 0 ] == '-' )
            {
                cor = false;
                continue;
            }
            h = time[ 0 ] - '0';
            m = ( time[ 2 ] - '0' ) * 10 + time[ 3 ] - '0';
            s = ( time[ 5 ] - '0' ) * 10 + time[ 6 ] - '0';
            tz += h * 3600 + m * 60 + s;
        }
        if ( cor )
        {
            th = float( tz ) / d;
            tz = int( th );
            if ( ( th - int( th ) ) * 2 >= 1 )
                tz++;
            printf("%3d: %d:%02d min/km\n", t, tz / 60, tz % 60);
        }
        else
            printf("%3d: -\n", t);
    }
    return 0;
}
